package cn.edu.scau.cmi.zhuanglinting.hibernate.domain;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "Teacher")
public class Teacher {

	@Id
	@Column(name = "ID")
	private int id;

	@Column(name = "name")
	private String name;

	@OneToMany(targetEntity = Student.class, mappedBy = "teacher", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	private Set<Student> studentSet;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Student> getStudentSet() {
		return studentSet;
	}

	public void setStudentSet(Set<Student> studentSet) {
		this.studentSet = studentSet;
	}
}

